package com.softtek.base.business.biz.impl;

import com.softtek.base.business.biz.QuestionTwoBiz;
import com.softtek.base.business.dao.QuestionTwoDao;
import com.softtek.base.domain.QuestionTwo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by li.chen on 8/19/2015.
 */
@Service("questionTwoBiz")
public class QuestionTwoBizImpl implements QuestionTwoBiz{

    private Logger logger = LoggerFactory.getLogger(QuestionTwoBizImpl.class);

    @Autowired
    private QuestionTwoDao questionTwoDao;

    @Override
    @Transactional
    public void addOrUpdate(QuestionTwo model,String questionFourAnswer) {
        if (model.getQuestionTwoId() != null && model.getQuestionTwoId() > 0) {
            logger.info("当前需修改的QuestionTwo对象QuestionTwoId为[" + model.getQuestionTwoId() + "]");
            questionTwoDao.update(model,questionFourAnswer);
        } else {
            logger.info("DepartmentInfoBizImpl添加departmentInfo！");
            questionTwoDao.add(model);
        }
    }
}
